import java.util.*;
public class T{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        char[] s=sc.next().toCharArray();
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i <s.length ; i++) {
            char ch=s[i];
            if(sb.length()!=0&&ch==sb.charAt(sb.length()-1)){
                sb.deleteCharAt(sb.length()-1);
            }else {
                sb.append(ch);
            }
        }
        System.out.println(sb.length()==0?0:sb.toString());

    }


}
